package com.quwan.manager.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.quwan.common.result.PageResult;
import com.quwan.manager.controller.dto.RechargeVipDTO;
import com.quwan.manager.service.RechargeVipService;
import com.quwan.mapper.TRechargeVipMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;

@Service
@RequiredArgsConstructor
public class RechargeVipServiceImpl implements RechargeVipService {
    @Autowired
    private TRechargeVipMapper tRechargeVipMapper;

    @Override
    public PageResult<RechargeVipDTO> users(int page, int size, String nikeName, String mobile, Long min, Long max, LocalDate minDate, LocalDate maxDate, Integer status, String name, Integer vipRuleId, Long mId, Integer payMethod) {
        Page<RechargeVipDTO> memberPage = tRechargeVipMapper.selectRechargeVipList(
                new Page(page, size),
                nikeName,
                mobile,
                min,
                max,
                minDate,
                maxDate,
                status,
                name,
                mId,
                vipRuleId,
                payMethod);

        return new PageResult<RechargeVipDTO>()
                .setRecords(memberPage.getRecords())
                .setPages(memberPage.getPages())
                .setSize(memberPage.getSize())
                .setTotal(memberPage.getTotal())
                .setCurrent(memberPage.getCurrent());
    }
}
